<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul class="list">
        <li class="item">1</li>
    </ul>
    <script>
        const listEle = document.getElementsByClassName('list')[0]
        const count = 100000
        //文档碎片容器
        const fragment = document.createDocumentFragment()
        for(var i=1;i<=count;i++){
            //创建li,在内里面
            const liEle = document.createElement('li')
            //设置文字
            liEle.innerText = i
            //放到容器里面
            fragment.prepend(liEle)
        }
        listEle.append(fragment)
    </script>
</body>
</html>